#ifndef DAEMON_H

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <signal.h>
#include <errno.h>
#include <string.h>
#include <paths.h>
#include <sqlite3.h>
#include <syslog.h>
#include <stdarg.h>

#define COLUMN_COUNT 12
/* parse buffer - ie, length of longest expected line */
#define LOGFILE_BUF_LEN     65536
/* log line store buffer */
#define LINE_LEN    4096    
#define MAX_LINES   4096
/* name of access log in sqlite database */
#define ACCESS_LOG "access_log"
/* number of binds */
#define NUM_BINDS 12

void foo();

static void logto_db(sqlite3 *db, sqlite3_stmt *ppStmt, char *lbuf);

void begin_transaction(sqlite3 *db);

/* This returns zero, if successful and one if it fails to rollback. */
int rollback(sqlite3 *db);

/* This returns zero, if successful and one if it fails to commit. */
int commit_transaction(sqlite3 *db);
    
void prepare_db(sqlite3 **pdb, sqlite3_stmt **ppStmt, char *db_file);

void teardown_db(sqlite3 *db);

int logging_daemon(const char *db_filename);

#endif
